<?php

header('Content-Type:text/html;charset=utf-8');


@$file=$_FILES['file1'];
@$b=$_POST['cpmz'];
@$c=$_POST['cpjg'];
@$d=$_POST['cplx'];
if(!empty($file)&&$file['error']==0){
var_dump($file);
	$fileName='';	
	$fileInfo=pathinfo($file['name']);
	if ($fileInfo['extension']=="jpg") {
		$a='tupian/'.$file['name'];
		echo $a;
		$PDO=new PDO('mysql:dbname=diancan;charset=UTF8;','root');
		
		$sel=$PDO->prepare('insert into vtbiao(name,unitprice,typeid,picture) values(:aa,:bb,(select id from vttype where typename=:cc),:dd)');

		$sel->execute(array('aa'=>$b,'bb'=>$c,'cc'=>$d,'dd'=>$a));


		header('Location:cpgl.php');

	}else{
		echo "文件类型不对！";
		header('Refresh:2;url=cpgl.php');
	}
}else{
	header('Location:cpgl.php');
}







?>